package net.kazed.nextaction.timer;

import net.kazed.nextaction.database.Task;
import android.content.BroadcastReceiver;
import android.content.ContentUris;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;

/**
 * Processes timer notification.
 * @author Koert Zeilstra
 *
 */
public class TimerProcessor extends BroadcastReceiver {

    /**
     * Constructor.
     */
    public TimerProcessor() {
      super();
   }

   @Override
    public void onReceive(Context context, Intent intent) {
         int taskId = Integer.parseInt(intent.getData().getLastPathSegment());
         Uri taskUri = ContentUris.withAppendedId(Task.CONTENT_URI, taskId);
         Intent notificationIntent = new Intent(Intent.ACTION_VIEW, taskUri);
      
         Notifier notifier = new Notifier(context);
         notifier.timerStop(notificationIntent);
   }

}
